package com.czl.module_storehouse.adapter;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.czl.base.data.bean.tengyun.SortBean;
import com.czl.module_storehouse.R;

import java.util.List;

/**
 * @author xubin
 */
public class AllocateDetailsAdapter extends BaseQuickAdapter<SortBean, BaseViewHolder> {

    private boolean visible = true;

    public AllocateDetailsAdapter(int layoutResId, @Nullable List<SortBean> data) {
        super(layoutResId, data);
    }

    public void setVisible(boolean visible) {
        this.visible = visible;
//        notifyDataSetChanged();
    }

    @Override
    protected void convert(@NonNull BaseViewHolder helper, SortBean item) {
        helper.setText(R.id.tv_sort_name, item.getSortName())
                .setText(R.id.tv_model, "型号：" + (item.getSortModel() == null ? "" : item.getSortModel()))
                .setText(R.id.tv_num, "数量：" + item.applyNum())
                .setVisible(R.id.tv_num, visible)
                .setText(R.id.tv_allocate_num, String.valueOf(item.lendNum()));
    }

}
